package com.goparry.taskman.maps;

import java.util.List;

import com.goparry.taskman.R;

import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.google.android.maps.OverlayItem;

import android.graphics.drawable.Drawable;
import android.os.Bundle;

public class MapsActivity extends MapActivity {
	private String mGeoLocation="";
	
    public String getGeoLocation() {
		return mGeoLocation;
	}

	public void setGeoLocation(String GeoLocation) {
		this.mGeoLocation = GeoLocation;
	}

	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.maps);
        
        MapView mapView = (MapView) findViewById(R.id.mapview);
        mapView.setBuiltInZoomControls(true);
        
        List<Overlay> mapOverlays = mapView.getOverlays();
        Drawable drawable = this.getResources().getDrawable(R.drawable.location64red);
        LocationsOverlay itemizedoverlay = new LocationsOverlay(drawable,this);
        
        GeoList locations = new GeoList();
        
        locations.add(new GeoLocation(29755211,-95719229,"GEO:0001","Location 1"));
        locations.add(new GeoLocation(29741965,-95796070,"GEO:0002","Location 2"));
        locations.add(new GeoLocation(29748477,-95700651,"GEO:0003","Location 3"));
        locations.add(new GeoLocation(29716652,-95743446,"GEO:0004","Location 4"));
        locations.add(new GeoLocation(29783539,-95798418,"GEO:0005","Location 5"));
        locations.add(new GeoLocation(29766126,-95780380,"GEO:0006","Location 6"));
        locations.add(new GeoLocation(29753251,-95711709,"GEO:0007","Location 7"));
        locations.add(new GeoLocation(29767024,-95798856,"GEO:0008","Location 8"));
        locations.add(new GeoLocation(29790427,-95778342,"GEO:0009","Location 9"));
        locations.add(new GeoLocation(29710907,-95737909,"GEO:0010","Location 10"));       
        
        for (GeoLocation gl : locations.getGeoLocations()) {

            OverlayItem overlayitem = new OverlayItem(gl, gl.getmTitle(), gl.getmSnippet());
            itemizedoverlay.addOverlay(overlayitem);      	
        }
                
        mapOverlays.add(itemizedoverlay);
        
        MapController controller = mapView.getController();
        controller.zoomToSpan(locations.getLatSpan(),locations.getLonSpan());
        controller.setCenter(locations.getCenter());
    }

	@Override
	protected boolean isRouteDisplayed() {
		// TODO Auto-generated method stub
		return false;
	}
	@Override
	public void onResume(){
		super.onResume();
		if (mGeoLocation.length() > 0) {
		}

		  

	}
}